<?
/*
* Smarty plugin
* -------------------------------------------------------------
* File:     function.url.php
* Type:     function
* Name:     link
* Purpose:  zwraca sformatowany url
* -------------------------------------------------------------
*/

function smarty_function_forumUrl($param, &$smarty)
{
	if (!isset($param['_section'])) {
		$param['_section'] = 'index';
	}

	$url = Config::Get('URL_FORUM') . '/' . $param['_section'] . '.php';

	unset($param['_section']);

	$urlParam = array();
	foreach ($param as $k => $v) {
		if ($k[0] != '_') {
			$urlParam[] = "$k=$v";
		}
	}

	return append_sid($url . (sizeof($urlParam) ? '?' . implode('&amp;', $urlParam) : ''), false, true, isset($_COOKIE["ezotbb_sid"]) ? $_COOKIE['ezotbb_sid'] : false);
}
?>